<!DOCTYPE html>
<html>
	<head>
		<script type="text/javascript" src="__STATIC__/js/jq.js">
			
		</script>
		<script type="text/javascript">
			$(function(){
				console.log(123)
				$("button#sub").click(function(){
					console.log(123);
					let form=new FormData();
					form.append("img",document.getElementById('file').files[0])
					console.log(document.getElementById('file').files[0])
					$.ajax({
						url:"http://localhost/tp5/publica/index/Api/upload",
						method:"post",
						data:form,
						contentType: false,
						            processData: false,
						success:function(x){
							console.log(x.data)
							
						},
						error:function(x){
							console.log("失败")
						}
						
					})
				})
			})
		</script>
		<script type="text/javascript">
			 // window.onload=function(){
				//  let sub=document.getElementById('sub');
				//  sub.onclick=function(){
				// 	 let form=new FormData();
				// 	 form.append("img",document.getElementById('file').files[0])
				// 	 console.log(document.getElementById('file').files[0])
				// 	 fetch("http://localhost/tp5/publica/index/Api/upload",{
						 
				// 	 })
				//  }
			 // }
		</script>
	</head>
	<body>
		<input type="file" name="file" id="file" value="" />
		<button type="button" id="sub">上传</button>
	</body>
</html>